package lxs.swift.tool.http;


import java.util.Map;

public abstract class KVSender extends SegSender {
    public KVSender(Config config, String prefix, String separator, String suffix) {
        super(config, prefix, separator, suffix);
    }


    public KVSender send(String key, Object value) {
        byte[] bytes = toBytes(key, value);
        super.write(bytes);
        return this;
    }

    public KVSender sendBatch(Map<String, Object> map) {
        map.forEach(this::send);
        return this;
    }

    public abstract byte[] toBytes(String key, Object value);

}
